package com.xiaoma.thread.interrupt;

/**
 * @author xiaomacdut
 * @date 2020年3月21日 下午12:01:08
 */
public class Run{
    
    public static void main(String [] args){
        
        /*        try{
            MyThread thread = new MyThread();
            thread.start();
            Thread.sleep(600);
            thread.interrupt();
            System.out.println("是否停止线程1" + thread.interrupted());
            System.out.println("是否停止线程2" + thread.interrupted());
        }catch(InterruptedException e){
            // TODO Auto-generated catch block
            e.printStackTrace();
        }*/
        
        Thread.currentThread().interrupt();
        System.out.println("是否停止线程1" + Thread.interrupted());//清空了中断标识，第二次输出的是false
        System.out.println("是否停止线程2" + Thread.interrupted());
        
    }
}
